﻿/*
 * Compares two specified string and returns an integer that indicates their relative position in the sort order.
 */
create function [String].[Compare] ( @p_String1 nvarchar(max), @p_String2 nvarchar(max) )
returns int as
begin

  if String.Equals( @p_String1, @p_String2 ) = 1
  begin
    return 0;
  end
  else if @p_String1 > @p_String2
  begin
    return -1;
  end
  else if @p_String1 < @p_String2
  begin
    return 1;
  end
  
  return null;

end